package validate

import (
	"github.com/gin-gonic/gin/binding"
	"github.com/go-playground/validator/v10"
)

func Register() {
	if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
		_ = v.RegisterValidation("username_unique", UserNameValidate)
		_ = v.RegisterValidation("email_unique", UserEmailValidate)
		_ = v.RegisterValidation("phone_unique", UserPhoneValidate)
		_ = v.RegisterValidation("phone", PhoneValidate)
		_ = v.RegisterValidation("article_category_name_unique", ArticleCategoryNameValidate)
		_ = v.RegisterValidation("tag_name_unique", TagNameValidate)
		_ = v.RegisterValidation("permissions_name_unique", PermissionsNameUniqueValidate)
		_ = v.RegisterValidation("permissions_code_unique", PermissionsCodeUniqueValidate)
		_ = v.RegisterValidation("roles_key_unique", RolesKeyUniqueValidate)
		_ = v.RegisterValidation("roles_name_unique", RolesNameUniqueValidate)
	}
}
